package com.tian.prototype;

/**
 * @author tiansongtao, Email:tiansongtao@up366.com
 * @date 2020/12/28 11:39
 */
public class PrototypeMain {
    public static void main(String[] args) {
        PrototypeEmail shallow = new PrototypeEmail();
        shallow.setCreateName("tian");
        EmailUser shallowUser = new EmailUser();
        shallowUser.setName("tian");
        shallow.setUser(shallowUser);
        EmailUserOne one = new EmailUserOne();
        one.setName("tian");
        shallow.setOneUser(one);
        System.out.println("shallow-------" + shallow.toString());

        PrototypeEmail shallowCopy = shallow.clone();
        shallowCopy.setCreateName("tao");
        shallowCopy.getUser().setName("tao");
        shallowCopy.getOneUser().setName("tao");
        System.out.println("ShallowCopy---" +shallowCopy.toString());
        System.out.println("shallow-------" +shallow.toString());

    }
}
